package com.daqsoft;

import com.daqsoft.interceptor.RequestInterceptor;
import org.apache.catalina.security.SecurityConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.Order;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.socket.config.annotation.*;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import javax.websocket.Session;

/**
 * @author 周麟东 on 15:27
 */
@SpringBootApplication
@EnableWebMvc
@EnableScheduling
@EnableTransactionManagement
@ComponentScan("com.daqsoft")
public class PMISAppLauncher {

    public static void main(String args[]) {
        SpringApplication.run(PMISAppLauncher.class);
    }

    /**
     * 注册拦截器
     */
    @Configuration
    static class WebMvcConfigurer extends WebMvcConfigurerAdapter {
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(new RequestInterceptor());
        }
    }
//    @Configuration
//    public  class WebSocketConfig {
//        @Bean
//        public ServerEndpointExporter serverEndpointExporter() {
//            return new ServerEndpointExporter();
//        }
//    }
}
